package com.sb.shiro.config;

import java.util.Date;

import org.apache.ibatis.reflection.MetaObject;

import com.baomidou.mybatisplus.mapper.MetaObjectHandler;

/**  自定义填充公共 name 字段  */
public class MyMetaObjectHandler extends MetaObjectHandler {


	@Override
	public void insertFill(MetaObject metaObject) {
		System.out.println("------------insertFill--------------");
		Object createdate = metaObject.getValue("createdate");
        System.err.println("createdate==" + createdate);
        if (null == createdate) {
            metaObject.setValue("createdate", new Date());
        }
	}

	@Override
	public void updateFill(MetaObject metaObject) {
		System.out.println("------------updateFill--------------");
		Object update = metaObject.getValue("update");
        System.err.println("update==" + update);
        if (null == update) {
            metaObject.setValue("update", new Date());
        }
	}
}
